<%--
  Created by IntelliJ IDEA.
  User: dzw
  Date: 2018/1/12
  Time: 13:16
  To change this template use File | Settings | File Templates.
--%>
<%--
  Created by IntelliJ IDEA.
  User: dzw
  Date: 2018/1/12
  Time: 9:48
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
  String path = request.getContextPath();
  String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";

%>

<div class="mui-card">
  <div class="mui-card-header">
    付款申请
    <button type="button" id="btn_add_pay" class="mui-btn mui-btn-primary" ${isStart}>新建付款申请</button>
  </div>
  <div id="page-content" class="mui-col-sm-12 mui-col-xs-12">
    <div class="table-jqgrid">
      <table id="pay_table"></table>
      <div id="pay_page"></div>
    </div>
  </div>
</div>

<script>

  $(function(){

    init_grid_pay();

  });

  function init_grid_pay() {
    __init_jqgrid('pay_table', 'pay_page',
            '<%=path%>/mp/pay/list?viewtype=${viewtype}',
            ['付款金额','支付对象',"操作","id"],
            [
              {name:'amount',index:'amount', width:100,search:false,sortable:true, searchoptions: {sopt: ['cn']}},
              {name:'object',index:'object', width:100,search:false,sortable:true, searchoptions: {sopt: ['cn']}},
              {name:'act',index:'act', width:60,sortable:false,search:false,fixed:true,formatter: actFormat},
              {name:'id',index:'id',search:false,hidden:true}
            ],
            true,true
    );
  }

  function actFormat(cellvalue, options, rowObject){
    var id = rowObject.id;
    cellvalue = '<button type="button" class="mui-btn" onclick="fn_pay_read(\'' + id + '\');">查看</button>';

    return cellvalue;
  }

  function fn_pay_read(id) {
    loadURL('<%=path%>/mp/pay/read?keyId='+id+'&viewtype=${viewtype}', $('#page-content'));
  }

  $("#btn_add_pay").click(function(){
    loadURL('<%=path%>/mp/pay/input', $('#page-content'));
  });
</script>